package com.hnkywl.sts.entity.organ;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.base.Xtgg;
import com.hnkywl.sts.entity.htgl.Fkfs;
import com.hnkywl.sts.entity.sys.Gw;
import com.hnkywl.sts.entity.sys.Yg;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

/**
 * 说明：公司机构
 * 包:        com.hnkywl.sts.entity.organ
 * 类描述:    公司机构
 * 修改备注: [说明本次修改内容]
 * 版本:        [v1.0]
 */
@Entity
@Table(name = "T_SYS_GSJG")
@Where(clause = "deleted!='1'")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING)
@DiscriminatorValue("gsjg")
public class Gsjg extends BaseEntity {
    @Id
    @SequenceGenerator(name = "seqGsjg", allocationSize = 1, sequenceName = "SEQ_SYS_GSJG")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqGsjg")
    private Long id;

    /**
     * 全称
     */
    private String qc;

    /**
     * 简称
     */
    private String jc;

    /**
     * 编码
     */
    private String bm;

    /**
     * 助记码
     */
    private String zjm;

    /**
     * 备注
     */
    private String bz;


    /**
     * 是否注销 0代表未注销  1代表已经注销
     */
    private Boolean sfzx = false;

    /**
     * 是否启用到货单入库 true启用；false停用
     */
    private Boolean sfqydhdrk = false;

    /**
     * 是否需要解质 0需要；1不需要
     */
    private Boolean sfxyjz = false;

    /**
     * 排序号
     */
    private Integer pxh;

    /**
     * 科目代码
     */
    private String kmdm;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "SJJG_ID")
    private Gsjg sjjg;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "YJG_ID")
    private Gsjg yjg;

    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "ssjgList")
    private List<Yg> ygList;

    /**
     * 公司机构所属岗位
     */
    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "T_SYS_GSJG_GW", joinColumns = {@JoinColumn(name = "GSJG_ID")}, inverseJoinColumns = {@JoinColumn(name = "GW_ID")})
    @Where(clause = "deleted!='1'")
    private List<Gw> gsjggwList;

    /**
     * 所有子机构
     */
    @OneToMany(mappedBy = "sjjg", cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Gsjg.class)
    @Where(clause = "deleted=0")
    @OrderBy("pxh asc,dateCreated desc ")
    private List<Gsjg> gsjgList;
    /**
     * 系统公告
     */
    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "gsjgList")
    private List<Xtgg> xtggList;

    /**
     * jiuqi组织代码
     */
    private String jiuqiUnitCode;

    /**
     * 企业法人
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "QYFR_ID")
    private Qyfr qyfr;


    private String zt;

    /**
     * 关联流程
     */
    @Basic
    @Column(name = "LC_ID")
    private String processInstanceId;

    /**
     * 联系手机
     */
    private String lxsj;

    @OneToMany(fetch = FetchType.LAZY, targetEntity = Fkfs.class)
    @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
    @JoinColumn(name = "QYJG_ID")
    private List<Fkfs> fkfsList;

    //保证金使用方式 :0:一次性使用  1:按比例使用,2:无保证金
    private Integer bzjfs;

    public Integer getBzjfs() {
        return bzjfs;
    }

    public void setBzjfs(Integer bzjfs) {
        this.bzjfs = bzjfs;
    }

    public List<Fkfs> getFkfsList() {
        return fkfsList;
    }

    public void setFkfsList(List<Fkfs> fkfsList) {
        this.fkfsList = fkfsList;
    }

    public List<Xtgg> getXtggList() {
        return xtggList;
    }

    public void setXtggList(List<Xtgg> xtggList) {
        this.xtggList = xtggList;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getQc() {
        return qc;
    }

    public Boolean getSfqydhdrk() {
        return sfqydhdrk;
    }

    public void setSfqydhdrk(Boolean sfqydhdrk) {
        this.sfqydhdrk = sfqydhdrk;
    }

    public void setQc(String qc) {
        this.qc = qc;
    }

    public String getJc() {
        return jc;
    }

    public void setJc(String jc) {
        this.jc = jc;
    }

    public String getBm() {
        return bm;
    }

    public void setBm(String bm) {
        this.bm = bm;
    }

    public String getZjm() {
        return zjm;
    }

    public void setZjm(String zjm) {
        this.zjm = zjm;
    }

    public String getBz() {
        return bz;
    }

    public void setBz(String bz) {
        this.bz = bz;
    }

    public Boolean getSfzx() {
        return sfzx;
    }

    public void setSfzx(Boolean sfzx) {
        this.sfzx = sfzx;
    }

    public Gsjg getSjjg() {
        return sjjg;
    }

    public void setSjjg(Gsjg sjjg) {
        this.sjjg = sjjg;
    }

    public Gsjg getYjg() {
        return yjg;
    }

    public void setYjg(Gsjg yjg) {
        this.yjg = yjg;
    }

    public List<Yg> getYgList() {
        return ygList;
    }

    public void setYgList(List<Yg> ygList) {
        this.ygList = ygList;
    }

    public List<Gsjg> getGsjgList() {
        return gsjgList;
    }

    public void setGsjgList(List<Gsjg> gsjgList) {
        this.gsjgList = gsjgList;
    }

    public Integer getPxh() {
        return pxh;
    }

    public void setPxh(Integer pxh) {
        this.pxh = pxh;
    }

    public String getKmdm() {
        return kmdm;
    }

    public void setKmdm(String kmdm) {
        this.kmdm = kmdm;
    }

    public String className() {
        return "Gsjg";
    }

    public String getJiuqiUnitCode() {
        return jiuqiUnitCode;
    }

    public void setJiuqiUnitCode(String jiuqiUnitCode) {
        this.jiuqiUnitCode = jiuqiUnitCode;
    }

    public Qyfr getQyfr() {
        return qyfr;
    }

    public void setQyfr(Qyfr qyfr) {
        this.qyfr = qyfr;
    }

    public List<Gw> getGsjggwList() {
        return gsjggwList;
    }

    public void setGsjggwList(List<Gw> gsjggwList) {
        this.gsjggwList = gsjggwList;
    }

    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    public String getProcessInstanceId() {
        return processInstanceId;
    }

    public void setProcessInstanceId(String processInstanceId) {
        this.processInstanceId = processInstanceId;
    }

    public String getLxsj() {
        return lxsj;
    }

    public void setLxsj(String lxsj) {
        this.lxsj = lxsj;
    }

    public Boolean getSfxyjz() {
        return sfxyjz;
    }

    public void setSfxyjz(Boolean sfxyjz) {
        this.sfxyjz = sfxyjz;
    }

}
